﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HotelBookingSystem.DataBaseStuff
{
    class displayStuff
    {
        private static _Broker pesho = new _Broker();
        public static uint FirstMenu()
        {
            Console.WriteLine("Choose City");
            for (int i = 0; i < pesho.cities.Length; i++)
            {
                Console.WriteLine("{0}. {1}", i + 1, pesho.cities[i].name);
            }
            Console.Write("Choice: ");
            return uint.Parse(Console.ReadLine());
        }

        public static uint[] SecondMenu(uint cityChoice)
        {
            Console.WriteLine("Choose Hotel ");
            int cnt = 0;
            foreach (_Hotel el in pesho.cities[cityChoice - 1].hotels)
            {
                Console.WriteLine("{0}. {1}", ++cnt, el.hotelName);
            }

            Console.Write("Choice: ");
            uint hotelChoice = uint.Parse(Console.ReadLine());
            return new uint[2] { cityChoice, hotelChoice };
        }

        public static uint[] ThirdMenu(uint[] choices)
        {
            Console.WriteLine("Choose Room Type ");
            Console.WriteLine("1. One Room with one bed");
            Console.WriteLine("2. One Room with two beds");
            Console.WriteLine("3. Appartment");

            Console.Write("Choice: ");
            return new uint[3] { choices[0], choices[1], uint.Parse(Console.ReadLine()) };
        }

        public static uint[] FourthMenu(uint[] choices)
        {
            ResultRoom roomSpans = new ResultRoom(new List<RoomInfo>(), "");
            switch (choices[2])
            {
                case 1:
                    roomSpans = _Hotel.CheckForRoom(pesho.cities[choices[0] - 1].hotels[choices[1] - 1].oneBed);
                    break;
                case 2:
                    roomSpans = _Hotel.CheckForRoom(pesho.cities[choices[0] - 1].hotels[choices[1] - 1].twoBed);
                    break;
                case 3:
                    roomSpans = _Hotel.CheckForRoom(pesho.cities[choices[0] - 1].hotels[choices[1] - 1].app);
                    break;
                default:
                    return new uint[4] { choices[0], choices[1], choices[2], 0 };
            }
            Console.Write(roomSpans.menuItem);
            Console.Write("Choice: ");
            uint periodChoice = uint.Parse(Console.ReadLine());

            pesho.cities[choices[0] - 1].hotels[choices[1] - 1].UpdateRooms(roomSpans, periodChoice, choices[2]);

            return new uint[4] { choices[0], choices[1], choices[2], periodChoice };
        }

        public static bool FifthMenu()
        {
            Console.WriteLine("Reservation Successful");
            Console.Write("Another Search (Y/N): ");
            string answer = Console.ReadLine();
            if (answer == "N")
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }

}